<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3d导航栏案例</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            margin: 100px;
        }
        ul li{
            float: left;
            margin: 0 5px;
            width: 120px;
            height: 35px;
            list-style: none;
            perspective: 500px;
            text-align: center;
            line-height: 35px;
            color: #fff;
        }
        .box{
            position: relative;
            width: 100%;
            height: 100%;
            transform-style:preserve-3d ;
            transition: all .4s;
        }
        .box:hover{
            transform: rotateX(90deg);
        }
        .front,
        .bottom{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        .front{
            background-color: pink;
            /* 只对定位盒子有效 */
            z-index: 1;
            /* 想象为一个以三维坐标系的x轴立方体，把粉色一面向前移动17.5px，旋转的中心点改变在于立方体的中心线上 */
            transform: translateZ(17.5px);

        }
        .bottom{
            background-color: purple;
            /* 先移动后旋转 */
            transform:translateY(17.5px) rotateX(-90deg);
        }
    </style>
</head>
<body>
    <ul>
        <li>
            <div class="box">
                <div class="front">白云</div>
                <div class="bottom">黑土</div>
            </div>
        </li>
        <li>
            <div class="box">
                <div class="front">白云</div>
                <div class="bottom">黑土</div>
            </div>
        </li>
        <li>
            <div class="box">
                <div class="front">白云</div>
                <div class="bottom">黑土</div>
            </div>
        </li>
        <li>
            <div class="box">
                <div class="front">白云</div>
                <div class="bottom">黑土</div>
            </div>
        </li>
    </ul>
</body>
</html>